<?php

abstract class AppController extends Controller {
    
    public function beforeFilter() {
        $lang = $this->language();
        $menu = PageModel::menu($lang);
        $this->set('menu', $menu);
    }

    protected function language() {
        $lang = Locale::get();
        if (! $lang) {
            $lang = Locale::primary();
        }

        return $lang;
    }
}